<html>
<head><meta charset="utf-8"><title>Coercions of other uninhabited types · t-lang/project-never-type · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/index.html">t-lang/project-never-type</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/Coercions.20of.20other.20uninhabited.20types.html">Coercions of other uninhabited types</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220030226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/Coercions%20of%20other%20uninhabited%20types/near/220030226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/Coercions.20of.20other.20uninhabited.20types.html#220030226">(Dec 15 2020 at 19:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Turns out the reason my question was unclear is that I was confused.  I think my trouble was just that <code>!</code> coerces to anything, but other uninhabited things don't (<code>Result&lt;!,!&gt;</code>, in my case).  So it wasn't anything special about the arm, just <code>!</code> being magical.</p>
<p>I ran into it in in making a PoC for a new <code>Try</code> design:<br>
<a href="https://github.com/rust-lang/rust/compare/master...scottmcm:do-or-do-not#diff-d8b2567155c41af008a45dc756c28463c57f205a95ca8ed18d6fb07b4b4a08bdR405">https://github.com/rust-lang/rust/compare/master...scottmcm:do-or-do-not#diff-d8b2567155c41af008a45dc756c28463c57f205a95ca8ed18d6fb07b4b4a08bdR405</a></p>
<p>That code used to work because the arm was <code>!</code>, so coerced to whatever, but with the change it became <code>Result&lt;!, !&gt;</code>, which <em>doesn't</em> coerce to anything, and thus needed the looks-pointless-at-face-value <code>.map_err(|x| x)</code>.</p>



<a name="220030378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/Coercions%20of%20other%20uninhabited%20types/near/220030378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/Coercions.20of.20other.20uninhabited.20types.html#220030378">(Dec 15 2020 at 19:32)</a>:</h4>
<p>In other words it boiled down to our old enemy "there's no <code>impl From&lt;!&gt;</code> for all types".</p>



<a name="239469389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/Coercions%20of%20other%20uninhabited%20types/near/239469389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/Coercions.20of.20other.20uninhabited.20types.html#239469389">(May 19 2021 at 17:59)</a>:</h4>
<p>Update here: the new <code>?</code> desugar is now in nightly, so the associated potential breakage from stabilizing <code>!</code> is no longer an issue.</p>



<a name="239556192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/Coercions%20of%20other%20uninhabited%20types/near/239556192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/Coercions.20of.20other.20uninhabited.20types.html#239556192">(May 20 2021 at 08:54)</a>:</h4>
<p>That's exciting</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>